app chooser dialog: Prevent uneven button heights
authorMatthias Clasen <mclasen@redhat.com>
Fri, 27 Feb 2015 01:55:54 +0000 (20:55 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 27 Feb 2015 02:16:58 +0000 (21:16 -0500)
The height of the text buttons depends on the font height,
whereas the search button has a fixed-size icon in it...
Prevent unevent heights by putting them all in a size group.

gtk/gtkappchooserdialog.c
gtk/ui/gtkappchooserdialog.ui

index 204b415607731d1c2178790914623147ca493c3e..c58206356a14898703bed98ad7bea855d8a5208f 100644 (file)
@@ -57,6 +57,7 @@
 #include "gtkheaderbar.h"
 #include "gtkdialogprivate.h"
 #include "gtksearchbar.h"
+#include "gtksizegroup.h"
 
 #include <string.h>
 #include <glib/gi18n-lib.h>
@@ -80,6 +81,8 @@ struct _GtkAppChooserDialogPrivate {
   GtkWidget *show_more_button;
   GtkWidget *software_button;
 
+  GtkSizeGroup *buttons;
+
   gboolean show_more_clicked;
   gboolean dismissed;
 };
@@ -494,6 +497,7 @@ setup_search (GtkAppChooserDialog *self)
 
       header = gtk_dialog_get_header_bar (GTK_DIALOG (self));
       gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
+      gtk_size_group_add_widget (self->priv->buttons, button);
 
       g_object_bind_property (button, "active",
                               self->priv->search_bar, "search-mode-enabled",
@@ -696,6 +700,7 @@ gtk_app_chooser_dialog_class_init (GtkAppChooserDialogClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, inner_box);
   gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, search_bar);
   gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, search_entry);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkAppChooserDialog, buttons);
   gtk_widget_class_bind_template_callback (widget_class, show_more_button_clicked_cb);
   gtk_widget_class_bind_template_callback (widget_class, software_button_clicked_cb);
 }
index bc7df6a932ec13321dfe98d1e400e81916a14239..be7dfe4ace96f4b5821bb40f6dfaa96c1eef52a5 100644 (file)
     <property name="receives_default">True</property>
     <signal name="clicked" handler="software_button_clicked_cb" swapped="no"/>
   </object>
+  <object class="GtkSizeGroup" id="buttons">
+    <property name="mode">vertical</property>
+    <widgets>
+      <widget name="cancel_button"/>
+      <widget name="ok_button"/>
+    </widgets>
+  </object>
 </interface>